import { legacy_createStore as createStore } from "redux";

const initState={
    count:0
}

export function  countReducer(state = initState, action:any){
    switch(action.type){
        case "ADD_COUNT":
            return {...state,count: state.count + action.number};
        default :
            return state;
    }
}

const initState2 = {
    name:"hello"
}

export function nameReducer(state = initState2,action:any){
    switch(action.type){
        case "UPDATE_NAME":
            return {...state,name:action.name};
        default :
            return state;
    }
}

const store = createStore(countReducer);

export default store;